MD = function(e, t, n) {
    var o, s, _, a = {}, b = {}, k = 65536, w = k - 1, C = function C(e) {
        this.digits = "boolean" == typeof e && !0 === e ? null : o.slice(0),
        this.isNeg = !1
    };
    function r(e) {
        var i = biDivideByRadixPower(e, this.k - 1),
            i = biMultiply(i, this.mu),
            i = biDivideByRadixPower(i, this.k + 1),
            e = biModuloByRadixPower(e, this.k + 1),
            i = biMultiply(i, this.modulus),
            i = biModuloByRadixPower(i, this.k + 1),
            n = biSubtract(e, i);
        n.isNeg && (n = biAdd(n, this.bkplus1));
        for (var o = 0 <= biCompare(n, this.modulus); o; )
            n = biSubtract(n, this.modulus),
            o = 0 <= biCompare(n, this.modulus);
        return n
    }
    function l(e, t) {
        t = biMultiply(e, t);
        return this.modulo(t)
    }
    function d(e, t) {
        var i = new C;
        i.digits[0] = 1;
        for (var n = e, o = t; 0 != (1 & o.digits[0]) && (i = this.multiplyMod(i, n)),
        0 != (o = biShiftRight(o, 1)).digits[0] || 0 != biHighIndex(o); )
            n = this.multiplyMod(n, n);
        return i
    }
    a.BarrettMu = function(e) {
        this.modulus = biCopy(e),
        this.k = biHighIndex(this.modulus) + 1;
        e = new C;
        e.digits[2 * this.k] = 1,
        this.mu = biDivide(e, this.modulus),
        this.bkplus1 = new C,
        this.bkplus1.digits[this.k + 1] = 1,
        this.modulo = r,
        this.multiplyMod = l,
        this.powMod = d
    },
    biModuloByRadixPower = function(e, t) {
        var i = new C;
        return arrayCopy(e.digits, 0, i.digits, 0, t),
        i
    },
    biMultiply = function(e, t) {
        for (var i, n, o, s = new C, a = biHighIndex(e), r = biHighIndex(t), l = 0; l <= r; ++l) {
            for (o = l,
            j = i = 0; j <= a; ++j,
            ++o)
                n = s.digits[o] + e.digits[j] * t.digits[l] + i,
                s.digits[o] = n & w,
                i = n >>> 16;
            s.digits[l + a + 1] = i
        }
        return s.isNeg = e.isNeg != t.isNeg,
        s
    },
    biDivideByRadixPower = function(e, t) {
        var i = new C;
        return arrayCopy(e.digits, t, i.digits, 0, i.digits.length - t),
        i
    },
    biDivide = function(e, t) {
        return biDivideModulo(e, t)[0]
    },
    setMaxDigits = function(e) {
        o = new Array(e);
        for (var t = 0; t < o.length; t++)
            o[t] = 0;
        s = new C,
        (_ = new C).digits[0] = 1
    },
    setMaxDigits(20),
    biCopy = function(e) {
        var t = new C(!0);
        return t.digits = e.digits.slice(0),
        t.isNeg = e.isNeg,
        t
    },
    reverseStr = function(e) {
        for (var t = "", i = e.length - 1; -1 < i; --i)
            t += e.charAt(i);
        return t
    };
    var c = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
    biToString = function(e, t) {
        var i = new C;
        i.digits[0] = t;
        for (var n = biDivideModulo(e, i), o = c[n[1].digits[0]]; 1 == biCompare(n[0], s); )
            n = biDivideModulo(n[0], i),
            digit = n[1].digits[0],
            o += c[n[1].digits[0]];
        return (e.isNeg ? "-" : "") + reverseStr(o)
    };
    var u = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
    digitToHex = function(e) {
        var t = "";
        for (i = 0; i < 4; ++i)
            t += u[15 & e],
            e >>>= 4;
        return reverseStr(t)
    },
    biToHex = function(e) {
        for (var t = "", i = (biHighIndex(e),
        biHighIndex(e)); -1 < i; --i)
            t += digitToHex(e.digits[i]);
        return t
    },
    charToHex = function(e) {
        e = 48 <= e && e <= 57 ? e - 48 : 65 <= e && e <= 90 ? 10 + e - 65 : 97 <= e && e <= 122 ? 10 + e - 97 : 0;
        return e
    },
    hexToDigit = function(e) {
        for (var t = 0, i = Math.min(e.length, 4), n = 0; n < i; ++n)
            t <<= 4,
            t |= charToHex(e.charCodeAt(n));
        return t
    },
    biFromHex = function(e) {
        for (var t = new C, i = e.length, n = 0; 0 < i; i -= 4,
        ++n)
            t.digits[n] = hexToDigit(e.substr(Math.max(i - 4, 0), Math.min(i, 4)));
        return t
    },
    biAdd = function(e, t) {
        var i;
        if (e.isNeg != t.isNeg)
            t.isNeg = !t.isNeg,
            i = biSubtract(e, t),
            t.isNeg = !t.isNeg;
        else {
            i = new C;
            for (var n, o = 0, s = 0; s < e.digits.length; ++s)
                n = e.digits[s] + t.digits[s] + o,
                i.digits[s] = n % k,
                o = Number(k <= n);
            i.isNeg = e.isNeg
        }
        return i
    },
    biSubtract = function(e, t) {
        if (e.isNeg != t.isNeg)
            t.isNeg = !t.isNeg,
            n = biAdd(e, t),
            t.isNeg = !t.isNeg;
        else {
            for (var i, n = new C, o = 0, s = 0; s < e.digits.length; ++s)
                i = e.digits[s] - t.digits[s] + o,
                n.digits[s] = i % k,
                n.digits[s] < 0 && (n.digits[s] += k),
                o = 0 - Number(i < 0);
            if (-1 == o) {
                for (s = o = 0; s < e.digits.length; ++s)
                    i = 0 - n.digits[s] + o,
                    n.digits[s] = i % k,
                    n.digits[s] < 0 && (n.digits[s] += k),
                    o = 0 - Number(i < 0);
                n.isNeg = !e.isNeg
            } else
                n.isNeg = e.isNeg
        }
        return n
    },
    biHighIndex = function(e) {
        for (var t = e.digits.length - 1; 0 < t && 0 == e.digits[t]; )
            --t;
        return t
    },
    biNumBits = function(e) {
        for (var t = biHighIndex(e), i = e.digits[t], n = 16 * (t + 1), o = n; n - 16 < o && 0 == (32768 & i); --o)
            i <<= 1;
        return o
    },
    biMultiplyDigit = function(e, t) {
        var i, n, o;
        result = new C,
        i = biHighIndex(e);
        for (var s = n = 0; s <= i; ++s)
            o = result.digits[s] + e.digits[s] * t + n,
            result.digits[s] = o & w,
            n = o >>> 16;
        return result.digits[1 + i] = n,
        result
    },
    arrayCopy = function(e, t, i, n, o) {
        for (var s = Math.min(t + o, e.length), a = t, r = n; a < s; ++a,
        ++r)
            i[r] = e[a]
    };
    var h = [0, 32768, 49152, 57344, 61440, 63488, 64512, 65024, 65280, 65408, 65472, 65504, 65520, 65528, 65532, 65534, 65535];
    biShiftLeft = function(e, t) {
        var i = Math.floor(t / 16)
          , n = new C;
        arrayCopy(e.digits, 0, n.digits, i, n.digits.length - i);
        for (var o = t % 16, s = 16 - o, a = n.digits.length - 1, r = a - 1; 0 < a; --a,
        --r)
            n.digits[a] = n.digits[a] << o & w | (n.digits[r] & h[o]) >>> s;
        return n.digits[0] = n.digits[a] << o & w,
        n.isNeg = e.isNeg,
        n
    };
    var g = [0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535];
    biShiftRight = function(e, t) {
        var i = Math.floor(t / 16)
          , n = new C;
        arrayCopy(e.digits, i, n.digits, 0, e.digits.length - i);
        for (var o = t % 16, s = 16 - o, a = 0, r = a + 1; a < n.digits.length - 1; ++a,
        ++r)
            n.digits[a] = n.digits[a] >>> o | (n.digits[r] & g[o]) << s;
        return n.digits[n.digits.length - 1] >>>= o,
        n.isNeg = e.isNeg,
        n
    },
    biMultiplyByRadixPower = function(e, t) {
        var i = new C;
        return arrayCopy(e.digits, 0, i.digits, t, i.digits.length - t),
        i
    },
    biCompare = function(e, t) {
        if (e.isNeg != t.isNeg)
            return 1 - 2 * Number(e.isNeg);
        for (var i = e.digits.length - 1; 0 <= i; --i)
            if (e.digits[i] != t.digits[i])
                return e.isNeg ? 1 - 2 * Number(e.digits[i] > t.digits[i]) : 1 - 2 * Number(e.digits[i] < t.digits[i]);
        return 0
    },
    biDivideModulo = function(e, t) {
        var i, n, o = biNumBits(e), s = biNumBits(t), a = t.isNeg;
        if (o < s)
            return e.isNeg ? ((i = biCopy(_)).isNeg = !t.isNeg,
            e.isNeg = !1,
            t.isNeg = !1,
            n = biSubtract(t, e),
            e.isNeg = !0,
            t.isNeg = a) : (i = new C,
            n = biCopy(e)),
            [i, n];
        i = new C,
        n = e;
        for (var r = Math.ceil(s / 16) - 1, l = 0; t.digits[r] < 32768; )
            t = biShiftLeft(t, 1),
            ++l,
            ++s,
            r = Math.ceil(s / 16) - 1;
        n = biShiftLeft(n, l),
        o += l;
        for (var d = Math.ceil(o / 16) - 1, c = biMultiplyByRadixPower(t, d - r); -1 != biCompare(n, c); )
            ++i.digits[d - r],
            n = biSubtract(n, c);
        for (var u = d; r < u; --u) {
            var h = u >= n.digits.length ? 0 : n.digits[u]
              , g = u - 1 >= n.digits.length ? 0 : n.digits[u - 1]
              , p = u - 2 >= n.digits.length ? 0 : n.digits[u - 2]
              , f = r >= t.digits.length ? 0 : t.digits[r]
              , m = r - 1 >= t.digits.length ? 0 : t.digits[r - 1];
            i.digits[u - r - 1] = h == f ? w : Math.floor((h * k + g) / f);
            for (var v = i.digits[u - r - 1] * (f * k + m), y = 4294967296 * h + (g * k + p); y < v; )
                --i.digits[u - r - 1],
                v = i.digits[u - r - 1] * (f * k | m),
                y = h * k * k + (g * k + p);
            c = biMultiplyByRadixPower(t, u - r - 1),
            (n = biSubtract(n, biMultiplyDigit(c, i.digits[u - r - 1]))).isNeg && (n = biAdd(n, c),
            --i.digits[u - r - 1])
        }
        return n = biShiftRight(n, l),
        i.isNeg = e.isNeg != a,
        e.isNeg && (i = a ? biAdd(i, _) : biSubtract(i, _),
        t = biShiftRight(t, l),
        n = biSubtract(t, n)),
        0 == n.digits[0] && 0 == biHighIndex(n) && (n.isNeg = !1),
        [i, n]
    };
    var p = function p(e, t, i) {
        this.e = biFromHex(e),
        this.d = biFromHex(t),
        this.m = biFromHex(i),
        this.chunkSize = 2 * biHighIndex(this.m),
        this.radix = 16,
        this.barrett = new a.BarrettMu(this.m)
    };
    this.getKeyPair = function(e, t, i) {
        return new p(e,t,i)
    },
    this.encryptedString = function(e, t) {
        for (var i = [], n = t.length, o = 0; o < n; )
            i[o] = t.charCodeAt(o),
            o++;
        for (; i.length % e.chunkSize != 0; )
            i[o++] = 0;
        for (var s, a, r, l = i.length, d = "", o = 0; o < l; o += e.chunkSize) {
            for (r = new C,
            s = 0,
            a = o; a < o + e.chunkSize; ++s)
                r.digits[s] = i[a++],
                r.digits[s] += i[a++] << 8;
            var c = e.barrett.powMod(r, e.e);
            d += (16 == e.radix ? biToHex(c) : biToString(c, e.radix)) + " "
        }
        return d.substring(0, d.length - 1)
    },
    setMaxDigits(130);
};

function rsaFun(password) {
    var md = new MD;
    var t = md.getKeyPair("10001", "", "ab86b6371b5318aaa1d3c9e612a9f1264f372323c8c0f19875b5fc3b3fd3afcc1e5bec527aa94bfa85bffc157e4245aebda05389a5357b75115ac94f074aefcd");
    return md.encryptedString(t, encodeURIComponent(password)).replace(/\s/g, "-")
}

console.log(rsaFun('qazwsx123'));